using System;
using System.IO;
using System.Net;
using System.Text;
public class FtpUtil
{
	public static readonly FtpUtil gclass5_0 = new FtpUtil();
	public string[] method_0(string string_0, string string_1, string string_2)
	{
		StringBuilder stringBuilder = new StringBuilder();
		string[] result;
		try
		{
			FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(new Uri(string_2));
			ftpWebRequest.UseBinary = true;
			ftpWebRequest.Credentials = new NetworkCredential(string_0, string_1);
			ftpWebRequest.Method = "NLST";
			ftpWebRequest.UsePassive = false;
			WebResponse response = ftpWebRequest.GetResponse();
			StreamReader streamReader = new StreamReader(response.GetResponseStream());
			for (string value = streamReader.ReadLine(); value != null; value = streamReader.ReadLine())
			{
				stringBuilder.Append(value);
				stringBuilder.Append("\n");
			}
			stringBuilder.Remove(stringBuilder.ToString().LastIndexOf('\n'), 1);
			streamReader.Close();
			response.Close();
			result = stringBuilder.ToString().Split(new char[]
			{
				'\n'
			});
		}
		catch (Exception)
		{
			result = null;
		}
		return result;
	}
	public void method_1(string string_0, string string_1, string string_2)
	{
		try
		{
			FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(new Uri(string_2));
			ftpWebRequest.Method = "MKD";
			ftpWebRequest.UseBinary = true;
			ftpWebRequest.Credentials = new NetworkCredential(string_0, string_1);
			ftpWebRequest.UsePassive = false;
			FtpWebResponse ftpWebResponse = (FtpWebResponse)ftpWebRequest.GetResponse();
			string arg_49_0 = ftpWebResponse.StatusDescription;
		}
		catch (Exception ex)
		{
			throw ex;
		}
	}
	public void method_2(string string_0, string string_1, string string_2, string string_3)
	{
		FileInfo fileInfo = new FileInfo(string_2);
		FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(new Uri(string_3 + fileInfo.Name));
		ftpWebRequest.Credentials = new NetworkCredential(string_0, string_1);
		ftpWebRequest.UsePassive = false;
		ftpWebRequest.KeepAlive = false;
		ftpWebRequest.Method = "STOR";
		ftpWebRequest.UseBinary = true;
		ftpWebRequest.ContentLength = fileInfo.Length;
		int count = 2048;
		byte[] buffer = new byte[2048];
		FileStream fileStream = fileInfo.OpenRead();
		try
		{
			Stream requestStream = ftpWebRequest.GetRequestStream();
			for (int count2 = fileStream.Read(buffer, 0, count); count2 != 0; count2 = fileStream.Read(buffer, 0, count))
			{
				requestStream.Write(buffer, 0, count2);
			}
			requestStream.Close();
			fileStream.Close();
		}
		catch (Exception)
		{
		}
	}
	public void method_3(string string_0, string string_1, string string_2)
	{
		try
		{
			FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(new Uri(string_2));
			ftpWebRequest.Method = "RMD";
			ftpWebRequest.UseBinary = true;
			ftpWebRequest.Credentials = new NetworkCredential(string_0, string_1);
			ftpWebRequest.UsePassive = false;
			FtpWebResponse ftpWebResponse = (FtpWebResponse)ftpWebRequest.GetResponse();
			string arg_49_0 = ftpWebResponse.StatusDescription;
		}
		catch (Exception ex)
		{
			throw ex;
		}
	}
	public void method_4(string string_0, string string_1, string string_2, string string_3)
	{
		try
		{
			FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(new Uri(string_2 + string_3));
			ftpWebRequest.Method = "DELE";
			ftpWebRequest.UseBinary = true;
			ftpWebRequest.Credentials = new NetworkCredential(string_0, string_1);
			ftpWebRequest.UsePassive = false;
			FtpWebResponse ftpWebResponse = (FtpWebResponse)ftpWebRequest.GetResponse();
			string arg_50_0 = ftpWebResponse.StatusDescription;
		}
		catch (Exception ex)
		{
			throw ex;
		}
	}
	public void method_5(string string_0, string string_1, string string_2, string string_3, string string_4)
	{
		try
		{
			FileStream fileStream = new FileStream(string_3 + "\\" + string_4, FileMode.Create);
			FtpWebRequest ftpWebRequest = (FtpWebRequest)WebRequest.Create(new Uri(string_2 + string_4));
			ftpWebRequest.Method = "RETR";
			ftpWebRequest.UseBinary = true;
			ftpWebRequest.Credentials = new NetworkCredential(string_0, string_1);
			ftpWebRequest.UsePassive = false;
			FtpWebResponse ftpWebResponse = (FtpWebResponse)ftpWebRequest.GetResponse();
			Stream responseStream = ftpWebResponse.GetResponseStream();
			long arg_6C_0 = ftpWebResponse.ContentLength;
			int count = 2048;
			byte[] buffer = new byte[2048];
			for (int i = responseStream.Read(buffer, 0, 2048); i > 0; i = responseStream.Read(buffer, 0, count))
			{
				fileStream.Write(buffer, 0, i);
			}
			responseStream.Close();
			fileStream.Close();
			ftpWebResponse.Close();
		}
		catch (Exception ex)
		{
			throw ex;
		}
	}
}
